package com.guigu.ababa.ababaclassroom.service.impl;


import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.guigu.ababa.ababaclassroom.dao.Ab_user_completeMapper;
import com.guigu.ababa.ababaclassroom.entity.Ab_user_complete;
import com.guigu.ababa.ababaclassroom.service.Ab_user_completeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.List;

//user_complete用户servcie接口实现类
@Service
@Transactional//(事务注解)
public class Ab_user_completeServiceImpl implements Ab_user_completeService {

    @Autowired
    Ab_user_completeMapper ab_user_completeMapper;

    //添加user_complete用户
    @Override
    public int insertuser_complete(Ab_user_complete ab_user_complete) {
        return ab_user_completeMapper.insert(ab_user_complete);
    }

    //查询user_complete用户(state=0)
    @Override
    public List<Ab_user_complete> findusercomplete() {
        return ab_user_completeMapper.selectList(null);
    }

    //修改user_complete用户
    @Override
    public int updateusercomplete(Ab_user_complete ab_user_complete) {
        return ab_user_completeMapper.updateById(ab_user_complete);
    }

    //修改ab_user用户(根据的ab_user_complete id)
    @Override
    public int updateuserID(int id,int state) {
        return ab_user_completeMapper.updatecomplete(id,state);
    }

    //修改ab_user_complete用户(根据id)
    @Override
    public int updatecompleteID(int id,int state) {
        return ab_user_completeMapper.updatecompleteID(id,state);
    }

    //查询单个user_complete(根据name)
    @Override
    public Ab_user_complete selectuser_complete(int id) {
        QueryWrapper<Ab_user_complete> wrapper = new QueryWrapper();
        wrapper.eq("userid",id);
        return   ab_user_completeMapper.selectOne(wrapper);
    }
}
